package com.hl.web.fore;

import com.hl.pojo.Fm;
import com.hl.service.FmService;
import com.hl.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/fm")
public class FmController {
    @Autowired
    private FmService fmService;

    @PostMapping("/add")
    public ResultEntity add(@RequestBody Fm fm) {
        return ResultEntity.ok(fmService.add(fm));
    }
    @GetMapping("/findAll")
    public ResultEntity findAll() {
        return ResultEntity.ok(fmService.findAll());
    }

    @GetMapping("/findById")
    public ResultEntity findById(Integer id) {
        return ResultEntity.ok(fmService.findById(id));
    }

    @PostMapping("/update")
    public ResultEntity update(@RequestBody Fm fm) {
        return ResultEntity.ok(fmService.update(fm));
    }

    @GetMapping("/deleteLogicalById")
    public ResultEntity deleteLogicalById(Integer id) {
        return ResultEntity.ok(fmService.deleteLogicalById(id));
    }

    @GetMapping("/findByTitle")
    public ResultEntity findByTitle(String title) {
        return ResultEntity.ok(fmService.findByTitle(title));
    }

}
